<template>
  <div class="wrapper">
    <detail-header></detail-header>
    <detail-banner :singleName="singleName" :currentImg="currentImg" :list="swiperimgList"></detail-banner>
    <detail-list></detail-list>
  </div>
</template>

<script>
import DetailBanner from './components/Banner'
import DetailHeader from './components/Header'
import DetailList from './components/List'
import axios from 'axios'
export default {
  name: 'Detail',
  components: {
    DetailHeader,
    DetailBanner,
    DetailList
  },
  data () {
    return {
      singleName: '',
      currentImg: '',
      swiperimgList: []
    }
  },
  methods: {
    getDetailInfo () {
      axios.get('/api/detail.json', {
        params: {
          id: this.$route.params.id
        }
      }).then(this.handleGetDetailSucc)
    },
    handleGetDetailSucc (res) {
      res = res.data
      if (res.ret && res.data) {
        const data = res.data
        this.singleName = data.singleName
        this.currentImg = data.currentImg
        this.swiperimgList = data.swiperimgList
      }
    }
  },
  mounted () {
    this.getDetailInfo()
  }
}
</script>

<style lang="stylus" scoped>
  .wrapper
    width 100%
    height 100%
    overflow-y hidden
</style>
